<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title></title>
	<script src="js/vue.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/mui.min.js"></script>
    <link href="css/mui.min.css" rel="stylesheet"/>

</head>
<body>
	<header class="mui-bar mui-bar-nav">
		<h1 class="mui-title">注册</h1>
	</header>
	<div class="mui-content">
		<form id='login-form' class="mui-input-group">
			<div class="mui-input-row">
				<label>账号</label>
				<input id='account' type="text" class="mui-input-clear mui-input" placeholder="请输入账号">
			</div>
			<div class="mui-input-row">
				<label>密码</label>
				<input id='password' type="password" class="mui-input-clear mui-input" placeholder="请输入密码">
			</div>
		</form>
		
		<div class="mui-content-padded">
			<button id='reg' class="mui-btn mui-btn-block mui-btn-primary">注册账号</button>
			<div class="link-area"><a id='login'>登录</a> <span class="spliter">
			</div>
		</div>

	</div>
	
	
	<script type="text/javascript" charset="utf-8">
	  (function($, doc) {
		  
		  function changeview(id){
			  var view=plus.webview.getWebviewById(id);
			  view.show();
		  }	  	
		  $.init({
	  		statusBarBackground: '#f7f7f7',
			subpages:[{
				url:'a.html',
				id:'a.html',
				style:{
					top:'0px',
					bottom:'44px'
				}
			},{
				url:'b.html',
				id:'b.html',
				style:{
					top:'0px',
					bottom:'44px'
				}
			}]
	  	});
		//检查 "登录状态/锁屏状态" 结束
		var loginButton = doc.getElementById('login');
		var accountBox = doc.getElementById('account');
		var passwordBox = doc.getElementById('password');
		var regButton = doc.getElementById('reg');
		var forgetButton = doc.getElementById('forgetPassword');
		
		regButton.addEventListener('tap', function(event) {
			$.ajax('http://192.168.1.3:8888/sys/user/login',{
				data:{
					username:accountBox.value,
					password:passwordBox.value
				},
				dataType:'json',//服务器返回json格式数据
				crossDomain:true,
				type:'post',//HTTP请求类型
				timeout:10000,//超时时间设置为10秒；data
				headers:{'Content-Type':'application/json'},	              
				success:function(data){
					if(data.code==0){
						$.toast("注册成功")
						
						setTimeout(function () {
							location.replace("login.html");
						},20);
					}
					
				},
				error:function(xhr,type,errorThrown){
					alert(type)
					//异常处理；
					console.log(type);
				}
			});
		});
		
		
	  }(mui, document));
	</script>
</body>
</html>